<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .top {
            height: 200px;
            width: 200px;
            background-color: pink;
            margin-bottom: 50px;
        }
        /* 垂直外边距合并，选择大的。左右不会受影响*/
        /* 解决方案就是给一个盒子添加margin */
        
        .bottom {
            height: 50px;
            width: 200px;
            background-color: purple;
            margin-top: 40px;
        }
    </style>
</head>

<body>
    <div class="top">

    </div>
    <div class="bottom"></div>
</body>

</html>